1 <?
2 echo $_SESSION[
"session_message"];
3 $_SESSION[
"session_message"] = "";
4 $MAXPAGE=
40;
5 ?>
6 <table height=
"28" cellSpacing="0" cellPadding="0" width="100%" border="0">
7       <tr align=center>
8         <td
class="title" width="100%">Rao vặt :
9     </td>
10       </tr>
11     </table>
12 <?
13     
switch ($_GET['action'])
14     {
15         
case 'del' :
16             $id = $_GET[
'id'];
17             $pro=GetAdvInfo($id);
18             
if ($pro)
19             {
20                 $sql =
"delete from avd where id='".$id."'";
21                 $result = mysql_query($sql,$con);
22                 
if ($result)
23                 {
24                     
if (file_exists("../".$pro['image'])) unlink("../".$pro['image']);
25                     
if (file_exists("../".$pro['image_large'])) unlink("../".$pro['image_large']);
26
27                     echo
"<p align=center class='err'>&#272;ã xóa thành công</p>";
28                 }
29                     
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
30             }
31             
break;
32     }
33 ?>
34
35 <?
36     
if (isset($_POST['ButDel'])) {
37         $cnt=
0;
38         
foreach ($_POST['chk'] as $id)
39         {
40             $pro=GetAdvInfo($id);
41             
if ($pro)
42             {
43                 @$result = mysql_query(
"delete from avd where id='".$id."'",$con);
44                 
if ($result) {
45                     $cnt++;
46                     
if (file_exists("../".$pro['image'])) unlink("../".$pro['image']);
47                     
if (file_exists("../".$pro['image_large'])) unlink("../".$pro['image_large']);
48
49                 }
50             }
51         }
52         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt." ph&#7847;n t&#7917;</p>";
53     }
54     
if (isset($_POST['ButGood'])) {
55         $cnt=
0;
56         
foreach ($_POST['chk'] as $id)
57         {
58             $pro=GetProductInfo($id);
59             
if ($pro)
60             {
61                 
if (CountRecord("pro_good","products_id=".$pro['products_id'])<=0)
62                 {
63                     $result = mysql_query(
"insert into pro_good (products_id,language,pro_dateadded) values ('".$pro['products_id']."','".$pro['language']."',SYSDATE())",$con);
64                     
if ($result) {
65                         $cnt++;
66                     }
67                 }
68             }
69         }
70         echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t ".$cnt." ph&#7847;n t&#7917;</p>";
71     }
72     
if (isset($_POST['ButNew'])) {
73         $cnt=
0;
74         
foreach ($_POST['chk'] as $id)
75         {
76             $pro=GetProductInfo($id);
77             
if ($pro)
78             {
79                 
if (CountRecord("pro_new","products_id=".$pro['products_id'])<=0)
80                 {
81                     $result = mysql_query(
"insert into pro_new (products_id,language,pro_dateadded) values ('".$pro['products_id']."','".$pro['language']."',SYSDATE())",$con);
82                     
if ($result) {
83                         $cnt++;
84                     }
85                 }
86             }
87         }
88         echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t ".$cnt." ph&#7847;n t&#7917;</p>";
89     }
90     
if (isset($_POST['ButSaleoff'])) {
91         $cnt=
0;
92         
foreach ($_POST['chk'] as $id)
93         {
94             $pro=GetProductInfo($id);
95             
if ($pro)
96             {
97                 
if (CountRecord("pro_saleoff","products_id=".$pro['products_id'])<=0)
98                 {
99                     $result = mysql_query(
"insert into pro_saleoff (products_id,language,pro_dateadded) values ('".$pro['products_id']."','".$pro['language']."',SYSDATE())",$con);
100                     
if ($result) {
101                         $cnt++;
102                     }
103                 }
104             }
105         }
106         echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t ".$cnt." ph&#7847;n t&#7917;</p>";
107     }
108     
109     
if (isset($_POST['trogia'])) {
110         $cnt=
0;
111         
foreach ($_POST['chk'] as $id)
112         {
113             $pro=GetProductInfo($id);
114             
if ($pro)
115             {
116                 @$result = mysql_query(
"update products set trogia=1 where id='".$id."'",$con);
117                 
if ($result) {
118                     $cnt++;
119
120                 }
121             }
122         }
123         echo
"<p align=center class='err'>Đã thêm ".$cnt." sản phẩm trợ giá</p>";
124     }
125     
126         
if (isset($_POST['huytrogia'])) {
127         $cnt=
0;
128         
foreach ($_POST['chk'] as $id)
129         {
130             $pro=GetProductInfo($id);
131             
if ($pro)
132             {
133                 @$result = mysql_query(
"update products set trogia=0 where id='".$id."'",$con);
134                 
if ($result) {
135                     $cnt++;
136
137                 }
138             }
139         }
140         echo
"<p align=center class='err'>Đã hủy ".$cnt." sản phẩm trợ giá</p>";
141     }
142     
143     
144     
145
146
147 ?>
148 <?
149     
if (isset($_POST['vip'])) {
150         $cnt=
0;
151         
foreach ($_POST['chk'] as $id)
152         {
153             
154             $sql_news=mysql_query(
"SELECT * FROM avd where id='".$id."' ");
155             $news=mysql_fetch_assoc($sql_news);
156
157             
if ($news)
158             {
159                 @$result = mysql_query(
"update avd set vip=1 where id='".$id."' ",$con);
160                 
if ($result) {
161                     $cnt++;
162
163                 }
164             }
165         }
166         echo
"<p align=center class='err'>Đã thêm ".$cnt." vào rao vặt vip</p>";
167     }
168 ?>
169 <?
170     
if (isset($_POST['un_vip'])) {
171         $cnt=
0;
172         
foreach ($_POST['chk'] as $id)
173         {
174             
175             $sql_news=mysql_query(
"SELECT * FROM avd where id='".$id."' ");
176             $news=mysql_fetch_assoc($sql_news);
177
178             
if ($news)
179             {
180                 @$result = mysql_query(
"update avd set vip=0 where id='".$id."' ",$con);
181                 
if ($result) {
182                     $cnt++;
183
184                 }
185             }
186         }
187         echo
"<p align=center class='err'>Đã hủy ".$cnt." tin rao vặt vip</p>";
188     }
189 ?>
190 <?
191     $page = $_GET[
"page"];
192     $p=
0;
193     
if ($page!='') $p=$page;
194     $
where="1=1";
195     
//if ($_REQUEST['status']!='') $where="products_status=".$_REQUEST['status']." ";
196     
if ($_REQUEST['cat']!='') $where="adv_cat=".$_REQUEST['cat'];
197 ?>
198 <?
199 function taotrang($total,$link,$nitem,$itemcurrent,$step=
10)
200 {
global $con;
201     $ret=
"";
202     
203     $param=
"";
204     $pages=count_page($total,$nitem);
205     
if ($itemcurrent>0) $ret.='<a title="&#272;&#7847;u tiên" href="'.$link.'0" class="lslink">[&lt;]</a> ';
206     
if ($itemcurrent>1) $ret.='<a title="V&#7873; tr&#432;&#7899;c" href="'.$link.($itemcurrent-1).'" class="lslink">[&lt;&lt;]</a> ';
207     $
from=($itemcurrent-$step>0?$itemcurrent-$step:0);
208     $to=($itemcurrent+$step<$pages?$itemcurrent+$step:$pages);
209     
for ($i=$from;$i<$to;$i++)
210     {
211         
if ($i!=$itemcurrent) $ret.='<a href="'.$link.$i.'" class="lslink">'.($i+1).'</a> ';
212         
else $ret.='<b>'.($i+1).'</b> ';
213     }
214     
if (($itemcurrent<$pages-2) && ($pages>1)) $ret.='<a title="Ti&#7871;p theo" href="'.$link.($itemcurrent+1).'">[&gt;&gt;]</a> ';
215     
if ($itemcurrent<$pages-1) $ret.='<a title="Cu&#7889;i cùng" href="'.$link.($pages-1).'">[&gt;]</a>';
216     
return $ret;
217 }
218
219     $pageindex=taotrang(CountRecord(
"avd",$where),"./?act=adv&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
220 ?>
221
222 <table cellspacing=
"0" cellpadding="0" width="100%">
223 <?
if ($_REQUEST['code']==1) echo '<tr><td colspan="2" align="center" class="err">&#272;ã c&#7853;p nh&#7853;t thành công</td></tr>'; ?>
224 <tr>
225 <td
class="smallfont">Trang : <? echo $pageindex; ?></td>
226 <td height=
"30" align="right" class="smallfont">
227     <
select size="1" name="ddCat" class="smallfont">
228 <?
229     $ms=GetListAdv(
0);
230     echo
'<option value="">[T&#7845;t c&#7843;]</option>';
231     
foreach ($ms as $m)
232         
if ($m[0]!=$_REQUEST['cat'])
233             echo
'<option value="'.$m[0].'">'.$m[1].'</option>';
234         
else
235             echo
'<option selected value="'.$m[0].'">'.$m[1].'</option>';
236 ?>
237     </
select>
238     <input type=
"button" value="Chuy&#7875;n" class="button" onclick="window.location='./?act=adv&cat='+ddCat.value">
239     </td>
240 </tr>
241 </table>
242 <table cellspacing=
"0" cellpadding="0">
243 <tr>
244 <td
class="smallfont">Tìm kiếm: </td>
245 <td
class="smallfont">
246 <!-- begin tim kiem-->
247 <form name=
"form_select" method="GET" action="./">
248 <table id=
"timkiem_home" border="0" id="table21" cellspacing="0" cellpadding="0">
249                     <tr>
250                         <td style=
"padding-left:4px;">
251 <
select size="1" name="cat_id">
252 <?
253     $ms=GetListAdv(
0);
254     echo
'<option value="">[T&#7845;t c&#7843;]</option>';
255     
foreach ($ms as $m)
256         
if ($m[0]!=$_REQUEST['cat'])
257             echo
'<option value="'.$m[0].'">'.$m[1].'</option>';
258         
else
259             echo
'<option selected value="'.$m[0].'">'.$m[1].'</option>';
260 ?>
261     </
select>
262   </td>
263 <td style=
"padding-left:0px">
264 <input name=
"keywords" type="text" id="input_timkiem" value="">
265 </td>
266 <td>
267 <input type=
"hidden" name="act" value="search_adv">
268 <input type=
"hidden" name="adv" value="search_adv">
269 <input id=
"button_search" type="submit" name="search" value="Tìm">
270 </td>
271 </tr>
272 </table>
273 </form>
274 <!-- end tim kiem -->
275 </td>
276 </tr>
277 </table>
278 <form method=
"POST" name="frmList" action="index.php">
279 <input type=hidden name=
"page" value="<? echo $page; ?>">
280 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
281   <tr>
282     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
283     <td colspan=
"2" nowrap class="title">&nbsp;</td>
284     <td align=
"center" nowrap class="title"><b>ID</b></td>
285      <td align=
"center" nowrap class="title"><b>Tên </b></td>
286     <td align=
"center" nowrap class="title"><b>Người đăng</b></td>
287 <td align=
"center" nowrap class="title"><b>Danh m&#7909;c hệ thống</b></td>
288 <td align=
"center" nowrap class="title"><b>Nơi đăng</b></td>
289 <td align=
"center" nowrap class="title"><b>Ngày đăng</b></td>
290
291   </tr>
292   
293   <?php
294             $sql=
"select * from avd where $where order by id DESC limit ".($p*$MAXPAGE).",".$MAXPAGE;
295             $result=mysql_query($sql,$con);
296             $i=
0;
297             
while(($row=mysql_fetch_array($result)))
298             {
299             $i++;
300             
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
301             $catinfo=GetCatAdvInfo($row[
'adv_cat']);
302             $cityinfo=GetCityInfo($row[
'city']);
303   ?>
304   
305   <tr>
306     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
307     <input type=
"checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
308     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
309     <a href=
"./?act=adv_m&cat=<? echo $_REQUEST['cat']; ?>&status=<? echo $_REQUEST['status']; ?>&id=<? echo $row['id']; ?>&page=<? echo $page?>">S&#7917;a</a></td>
310     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
311     <a onclick=
"return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" href="./?act=adv&action=del&cat=<? echo $_REQUEST['cat']; ?>&status=<? echo $_REQUEST['status']; ?>&id=<? echo $row['id']; ?>">Xoá</a></td>
312     <td bgcolor=
"<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['id']; ?>&nbsp;</td>
313     <td bgcolor=
"<? echo $color; ?>" class="smallfont">
314     <a href=
"../?home=adv&act=views&id=<? echo $row['id']; ?>&cat=<? echo $row['adv_cat']; ?>" target="_blank"><? echo $row['name']; ?></a>
315    </td>
316     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['user']; ?>&nbsp;</td>
317     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $catinfo['name']; ?>&nbsp;</td>
318     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><?if($row['city']=='0'){?>TOÀN QUỐC<?}else{?><? echo $cityinfo['name']; ?><?}?>&nbsp;</td>
319     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['date']; ?>&nbsp;</td>
320
321   </tr>
322   <?
323                 }
324   ?>
325 </table>
326 <input type=
"hidden" name="act" value="adv"><table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
327     <tr>
328         <td>
329 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button"></td>
330         <td align=
"right">
331        </td>
332 <td align=
"right">
333 <input type=
"submit" value="Ch&#7885;n là Vip" name="vip" class="button">
334 <input type=
"submit" value="Hủy tin Vip" name="un_vip" class="button">
335 </td>
336
337
338     </tr>
339 </table>
340 </form>
341 <script language=
"JavaScript">
342 function chkallClick(o) {
343     
var form = document.frmList;
344     
for (var i = 0; i < form.elements.length; i++) {
345         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
346             form.elements[i].
checked = document.frmList.chkall.checked;
347         }
348     }
349 }
350 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.977 lượt xem

Gõ tìm kiếm nhanh...